using OneDayModel.Interfaces;

namespace OneDayModel.Model
{
    public class UserLoginModel
    {
        private readonly IRepository repository;
        private readonly IOnlineCache onlineCache;

        public UserLoginModel(IRepository repository, IOnlineCache onlineCache)
        {
            this.repository = repository;
            this.onlineCache = onlineCache;
        }

        public IUser GetUserByAlias(string alias)
        {
            return repository.GetUserByAlias(alias);
        }

        public void MarkOnline(IUser user)
        {
            onlineCache.RegisterUserOnline(user["Alias"]);
        }
    }
}